package top.fengleifeng.question;

import top.fengleifeng.util.Constants;

/**
 * @program: leetcode-test
 * @description:
 * @author: fengleifeng
 * @create: 2020-10-19 15:52
 **/
public class Num1317将整数转换为两个无零整数的和 {
    class Solution {
        public int[] getNoZeroIntegers(int n) {
            for (int i = 1; i < n; i++) {
                int k = n - i;
                if (check(i) && check(k)) {
                    return new int[]{i, k};
                }
            }
            return new int[]{};
        }

        private boolean check(int i) {
            String s = String.valueOf(i);
            return !s.contains("0");
        }

        private boolean check2(int i) {
            while (i > 0) {
                if (i % 10 == 0) {
                    return false;
                }
                i = i / 10;
            }
            return true;
        }
    }

    public static void main(String[] args) {
        int[] noZeroIntegers = new Num1317将整数转换为两个无零整数的和().new Solution().getNoZeroIntegers(2);
        Constants.printArr(noZeroIntegers);
    }
}
